from multiprocessing import Process,Queue

def write(q):
    li = ["小红","小明","小黑"]
    for i in li:
        print(f"{i}被存进去了")
        q.put(i)

def read(q):
    # q.get() 判断 empty()  qsize()
    for i in range(q.qsize()):
        print(f"{q.get()}被拿出来了")

if __name__ == '__main__':
    q = Queue()
    p1 = Process(target=write,args=(q,))  # 把q队列对象当做参数传进去
    p2 = Process(target=read,args=(q,))
    p1.start()
    p1.join() # p1 -- p2
    p2.start()